#version 450

layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec3 inNormal;
layout (location = 2) in vec2 inUV;

layout (binding = 0) uniform UBO {
    mat4 proj;
	mat4 view;
} ubo;

layout (push_constant) uniform PushConstants
{ 
	mat4 model;
	vec3 albedo;
	uint hasTexture;
} pushConstants;

layout (location = 0) out vec3 outPosition;
layout (location = 1) out vec3 outNormal;
layout (location = 2) out vec2 outUV;

void main() {
	vec4 positionInViewSpace = ubo.view * pushConstants.model * vec4(inPosition, 1.0);
	gl_Position = ubo.proj * positionInViewSpace;
	outPosition = positionInViewSpace.xyz;
	outNormal = normalize(mat3(transpose(inverse(ubo.view * pushConstants.model))) * inNormal);
	outUV = inUV;
}
